import Moment from 'moment';
import {Toast} from 'vant';
import Api from '../api';
import { getActivityList, getInfoByToken } from '../api/api.js';
const actions = {
    getActivityListApi({commit}) {
        let dateNow = Moment().format('YYYY-MM-DD HH:mm:ss');
        Api.get(getActivityList, {}).then(res => {
            res.forEach(item => {
                item.DateNow = dateNow;
            });
            commit('getActivity', res);
        });
    },
    getLoginInfoApi({commit}) {
        if (localStorage['token']) {
            Api.get(getInfoByToken, {headers: { Authorization: localStorage['token'] }}).then(res => {
                commit('getLoginInfo', res);
            });
        } else {
            Toast('请先登录');
        }
    },
    setST({commit}, data) {
        commit('SET_ST', data);
    },
    setUserType({commit}, data) {
        commit('SET_USERTYPE', data);
    },
    setName({commit}, data) {
        commit('SET_NAME', data);
    },
    setVerifyVode({commit}, data) {
        commit('SET_VERIFYVODE', data);
    },
    setPhone({commit}, data) {
        commit('SET_PHONE', data);
    },
    setCompany({commit}, data) {
        commit('SET_COMPANY', data);
    },
    setPost({commit}, data) {
        commit('SET_POST', data);
    },
    setHeadImage({commit}, data) {
        commit('SET_HEADIMAGE', data);
    },
    setIDCard({commit}, data) {
        commit('SET_IDCARD', data);
    },
    setIdentifier({commit}, data) {
        commit('SET_IDENTIFIER', data);
    },
    setUnionId({commit}, data) {
        commit('SET_UNIONID', data);
    },
    setProvinceCityDistrict({commit}, data) {
        commit('SET_PROVINCECITYDISTRICT', data);
    },
    setProvince({commit}, data) {
        commit('SET_PROVINCE', data);
    },
    setCity({commit}, data) {
        commit('SET_CITY', data);
    },
    setDistrict({commit}, data) {
        commit('SET_DISTRICT', data);
    },
    setSex({commit}, data) {
        commit('SET_SEX', data);
    },
    setWish({commit}, data) {
        commit('SET_WISH', data);
    },
    setAge({commit}, data) {
        commit('SET_AGE', data);
    },
    setAddress({commit}, data) {
        commit('SET_ADDRESS', data);
    },
    setEmail({commit}, data) {
        commit('SET_EMAIL', data);
    },
    setAboutUs({commit}, data) {
        commit('SET_ABOUTUS', data);
    },
    setBusinessLicense({commit}, data) {
        commit('SET_BUSINESSLICENSE', data);
    },
    setTaxNumber({commit}, data) {
        commit('SET_TAXNUMBER', data);
    },
    setUserAgent({commit}, data) {
        commit('SET_USERAGENT', data);
    },
    setCountry({commit}, data) {
        commit('SET_COUNTRY', data);
    },
    setCertificateTypeNum({commit}, data) {
        commit('SET_CERTIFICATETYPEENUM', data);
    },
    setTitle({commit}, data) {
        commit('SET_TITLE', data);
    },
    setIsMatchMaking({commit}, data) {
        commit('SET_ISMATCHMAKING', data);
    },
    setIsDietary({commit}, data) {
        commit('SET_ISDIETARY', data);
    },
    setDietaryTaboos({commit}, data) {
        commit('SET_DIETARYTABOOS', data);
    },
    setIsAdvertising({commit}, data) {
        commit('SET_ISADVERTISING', data);
    },
    setCustomValue({commit}, data) {
        commit('SET_CUSTOMVALUE', data);
    },
    setCustomValueTwo({commit}, data) {
        commit('SET_CUSTOMVALUETWO', data);
    },
    setCustomValueThree({commit}, data) {
        commit('SET_CUSTOMVALUETHREE', data);
    },
    setQuest({commit}, data) {
        commit('SET_QUEST', data);
    },
    setOpenId({commit}, data) {
        commit('SET_OPENID', data);
    },
    setTicketId({commit}, data) {
        commit('SET_TICKETID', data);
    },
    setBuyNum({commit}, data) {
        commit('SET_BUYNUM', data);
    },
    setPromoCode({commit}, data) {
        commit('SET_PROMOCODE', data);
    },
    setSessionID({commit}, data) {
        commit('SET_SESSIONID', data);
    },
    setPromotionCode({commit}, data) {
        commit('SET_PROMOTIONCODE', data);
    },
    setBilingual({commit}, data) {
        commit('setBilingual', data);
    }
};

export default actions;